import { mapGetters } from "vuex";
export default {
  computed: {
    ...mapGetters(["requireMap"])
  },
  created() {
    this.dictMap = this.setDictMap(this.taskShowTypeOption, {
      key: "value",
      value: "label"
    }); // 设置字典对应值
    console.log(this.dictMap);
    this.typeCodeMap = this.setDictMap(this.typeOptions, {
      key: "id",
      value: "name"
    }); // 租户名称字典
    console.log(this.typeCodeMap);
  },
  data() {
    return {
      dictMap: {}, // 设置字典对应值
      typeCodeMap: {} // 租户名称字典
    };
  },
  methods: {
    // 设置字典对应值
    setDictMap(data, { key, value }) {
      let map = {};
      data.forEach(v => {
        if (!map[v[key]]) {
          map[v[key]] = v[value];
        }
      });
      return map;
    }
  }
};
